clear
capture log close
set more off
use Couples1980

keep statefip metarea age race educd hispan incwage age_m qsex qeduc qocc qincwage agemarr marrno marrno_m hwage

keep if qsex==0
keep if qeduc==0
keep if qocc==0
keep if qincwage==0

drop qsex qeduc qocc 

replace incwage=incwage*172.2/82.4
replace hwage=hwage*172.2/82.4
gen urban=(metarea==0)
gen white=(race==1&hispan==0)
gen black=(race==2&hispan==0)
gen hisp=(hispan!=0)
gen nohs=(educd<60)
gen hs=(educd>=60& educd<100)
gen coll=(educd==100)
gen adv=(educd>100)

gen agediff=age_m-age
gen pos=(agediff>0)
gen agediffpos=agediff*pos
gen agediffneg=agediff*(1-pos)*(-1)
gen ap1=(agediffpos>=2&agediffpos<=4)
gen ap2=(agediffpos>=5&agediffpos<=7)
gen ap3=(agediffpos>=8)
gen an1=(agediffneg>=2&agediffneg<=4)
gen an2=(agediffneg>=5&agediffneg<=7)
gen an3=(agediffneg>=8)

tab age, gen(wfe)
gen agehs=age*hs
tab agehs, gen(whsfe)
gen agecoll=age*coll
tab agecoll, gen(wcollfe)
gen ageadv=age*adv
tab ageadv, gen(wadvfe)
gen stfips=urban*100+statefip
tab stfips, gen(stu)

keep if marrno==1
gen agem2=agemarr*agemarr
gen marr2=(marrno_m==2)
gen marr3=(marrno_m>=3)

keep if hwage!=.
keep if hwage!=0

log using Tab3_women_1980_col3col4.log, replace

reg hwage ap1 ap2 ap3 an1 an2 an3 agemarr agem2 marr2 marr3 white black hisp stu* wfe* whsfe* wcollfe* wadvfe*, robust
tobit incwage ap1 ap2 ap3 an1 an2 an3 agemarr agem2 marr2 marr3 white black hisp stu* wfe* whsfe* wcollfe* wadvfe* , ll(0) robust

log close




